package com.app.service.impl;

import com.app.mapper.AdminUserMapper;
import com.app.mapper.WorkApplyMapper;
import com.app.model.AdminUserModel;
import com.app.model.WorkApplyModel;
import com.app.service.AdminUserService;
import com.app.service.WorkApplyService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @Description:投递简历记录
 * @Author: N
 * @Date: 2022年11月24日 10点29分
 */
@Service
@Primary
public class AdminUserServiceImpl implements AdminUserService {
    @Autowired
    AdminUserMapper adminUserMapper;

    @Override
    public AdminUserModel getUserByUserName(String userName, String password) {
        QueryWrapper<AdminUserModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select().eq("user_name", userName);
        queryWrapper.select().eq("pass_word", password);
        List<AdminUserModel> userList = adminUserMapper.selectList(queryWrapper);
        if (userList.isEmpty()) {
            return null;
        } else {
            return userList.get(0);
        }
    }

    @Override
    public AdminUserModel getUserById(int userId) {
        return adminUserMapper.selectById(userId);
    }

    @Override
    public void update(AdminUserModel model) {
        adminUserMapper.updateById(model);
    }

    @Override
    public int insert(AdminUserModel model) {
        return adminUserMapper.insert(model);
    }


}
